libname mylib 'g:\Dropbox\Wall Street Bets (Private)\Data';


*This program contains the information needed to create Table 3 of the paper;
*The program references daily_panel_rfs.
This dataset is constructed in  Daily Panel RFS (Intermediate File) code;



DATA INFO;
SET MYLIB.DAILY_PANEL_RFS;

if cum_month <=24 then quarter =0;
if 25<=cum_month<=27 then quarter =1;
if 28<=cum_month<=30 then quarter =2;
if 31<=cum_month<=33 then quarter =3;
if 34<=cum_month<=36 then quarter =4;
if cum_month = 37 and post_gme =0 then quarter =4;
if 37<=cum_month<=39 and post_gme=1 then quarter =5;
if 40<=cum_month<=42 and post_gme=1 then quarter =6;
keep ticker date cum_month gme_amc_flag post_gme
ret5 ret21
net_dd2  NET_DD2_POST NET_SA2 NET_SA2_POST NON_RESEARCH2 NON_RESEARCH2_POST
DD_and_SA DD_and_SA_POST DD_and_Non_Research DD_and_Non_Research_post net_dd2_pre
 ln_size ln_bm  abn_ret mom5 mom6_26     
BM_MISSING SIZE_MISSING   news_sentiment lag_sent5 lag_sent6_26 SENTIMENT21 quarter;
RUN;


PROC SORT DATA=info;
BY DATE;
RUN;
PROC STANDARD DATA=info OUT=INFO_FE MEAN=0;
BY DATE;
var ret5 ret21
net_dd2  NET_DD2_POST NET_SA2 NET_SA2_POST NON_RESEARCH2 NON_RESEARCH2_POST
DD_and_SA DD_and_SA_POST DD_and_Non_Research DD_and_Non_Research_post net_dd2_pre
 ln_size ln_bm  abn_ret mom5 mom6_26     
BM_MISSING SIZE_MISSING   news_sentiment lag_sent5 lag_sent6_26 SENTIMENT21;
*WHERE GME_AMC_FLAG =0;
RUN;

*this code reports the results for each quarter for the full sample;
* To obtain the estimates excluding GME & AMC, impose the filter "where gme_amc_flag  =0" by removing the "*" in the first line of code;
*note - no need for cluster 2 code since not reporting standard errors of estimates in Figure 3;

proc sort data=info_fe;
by quarter;
run;
proc surveyreg data=info_fe;
cluster cum_month;
model ret21 = net_dd2  NET_DD2 NET_SA2  NON_RESEARCH2  ln_size ln_bm  abn_ret mom5 mom6_26       news_sentiment lag_sent5 lag_sent6_26   BM_MISSING SIZE_MISSING;
by quarter;
RUN;

